package com.example.soft.demos.web;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class RandomSelectionStrategy implements PaperSelectionStrategy {
    @Override
    public List<Paper> selectPapers(List<Paper> availablePapers, int quantity) {
        if (availablePapers == null || availablePapers.isEmpty()) {
            return new ArrayList<>();
        }
        Collections.shuffle(availablePapers);
        int selectCount = Math.min(quantity, availablePapers.size());
        return new ArrayList<>(availablePapers.subList(0, selectCount));
    }
}
